<template>
    <div class="goodsdesc-container">
        <h1 class="title">{{ this.goodsDesc.title }} </h1>
        <hr>
        <div class="content" v-html="goodsDesc.content"></div>
    </div>
</template>


<script>
export default {
    data() {
        return {
            id: this.$route.params.id,
            goodsDesc: {}   // 商品描述
        }
    },
    mounted () {
        this.getGoodsDesc();
    },
    methods: {
        // 获取商品图文信息
        getGoodsDesc() {
            this.$http.get('api/goods/getdesc/' + this.id).then(result => {
                if (result.body.status === 0) {
                    this.goodsDesc = result.body.message[0];
                }
            })
        }
    }
}
</script>

<!-- 
    去掉 scoped 属性，否则图片样式不生效!
    <style lang="scss" scoped> 
-->

<style lang="scss" >
.goodsdesc-container {
    padding: 5px;
    .title {
        font-size: 16px;
    }

  .content{
    img{
      width: 100%;
    }
  }
}
</style>
